/*
** my_put_nbr.c for my_put_nbr in /home/goupil_r//afs/local
** 
** Made by robin goupil
** Login   <goupil_r@epitech.net>
** 
** Started on  Wed Oct  3 14:10:53 2012 robin goupil
** Last update Sun Nov 18 10:28:37 2012 robin goupil
*/

void	my_get_rest(long u_nb, long size)
{
  long	rest;
  long	out;

  out = 0;
  rest = 0;
  while (rest != u_nb)
    {
      out = (u_nb / size) - (rest * 10);
      my_putchar(out + 48);
      size = size / 10;
      rest = (rest * 10) + out;
    }
}

void	my_put_unsigned_nbr(unsigned int nb)
{
  long	size;
  long	sign;

  size = 1;
  sign = 1;
  while (nb / (size * 10) != 0)
    size = size * 10;
  if (nb == 0)
    my_putchar('0');
  my_get_rest(nb * sign, size);
}

void	my_put_nbr(int nb)
{
  long	size;
  long	sign;

  size = 1;
  sign = 1;
  while (nb / (size * 10) != 0)
    size = size * 10;
  if (nb < 0)
    {
      my_putchar('-');
      sign = (-1);
    }
  if (nb == 0)
    my_putchar('0');
  my_get_rest(nb * sign, size);
}
